import { addCar, getCar, removeCar } from "@/api/api";

export default {
    namespaced: true,
    state: () => ({
        carList: []
    }),
    mutations: {
        changecarList(state, payload) {
            state.carList = payload.map(item => ({ ...item, flag: true }))
            console.log(state.carList)
        }
    },
    actions: {
        async addcarActions({ commit, rootState }, shop_id) {
            const user_id = rootState.user.uid
            // console.log(user_id)
            await addCar({ user_id, shop_id })
            if (res.data.status == 200) {
                console.log('添加成功', res);
            }
        },
        async getCarActions({ commit, rootState }) {
            let user_id = rootState.user.uid
            console.log(user_id);
            let res = await getCar({ user_id })
            console.log(res)
        }
    }
}